package com.musicalevents.dao.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.sql.JoinType;

import com.musicalevents.dao.PlaceDAO;
import com.musicalevents.entity.Place;


@SuppressWarnings("unchecked")
public class PlaceDAOImpl extends GenericDAOImpl<Place, Integer> implements PlaceDAO {

	public PlaceDAOImpl(Class<Place> type) {
		super(type);
	}

	public List<Place> fetchAllPlacesLinkTown() {
		
		Criteria crit = getSession().createCriteria(Place.class);
		crit.createAlias("town", "t", JoinType.INNER_JOIN);
		List<Place> places = crit.list();
		return (places);
	}
}
